<template>
  <!-- 岗位设置 -->
  <div>
    <!-- 搜索 -->
    <TopFilter
      :list="topFilterInit"
      :cols="3"
      labelWidth="100"
      @filterChange="changeHandle"
      @onCollapse="collapseHandle"
      ></TopFilter>
     <!-- table -->
    <FilterTable
       ref="table"
       :columns="columns"
       :fetchapi="fetchApi"
       :isSelectColumn="isSelectColumn"
       :params="flterValue"
       :datakey="'records'"
       :onColumnsChange="columns => this.columns = columns"
      columnsRef="originDLR_postSet_index_01"

       >
    </FilterTable>
   <!-- 详情窗口 -->
    <BaseDialog title="岗位信息维护" :visible.sync="visible"
      width="400px"
      destroyOnClose
      :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}" >
   </BaseDialog>
  </div>
</template>
<script>
// import infoModal from './info' 弹窗的意思
import { pageDealerStationMaintaion } from '@/api/cms-api/personnelInfo/postSet/index';
import { dictionary } from '@/utils/dictMixin';
export default {
  name:'originDLRPostSet',
  mixins: [dictionary],
  components: {
  },
  data() {
    return {
      visible:false,
      isSelectColumn:false,
      topFilterInit:this.topFilterInitFun(),
      flterValue:{enable:10031001},  //参数
      columns:this.creatHeader(),
      flterValue:{
        enable:10031001//编辑表单 只显示启用状态
      }, //ipa 接口
      fetchApi:pageDealerStationMaintaion
    };
  },
  mounted() {
   // this.BaseTable = this.$refs.table.$refs.pageTable;
  },
  methods: {
      //搜索数据
      topFilterInitFun(){
        return [
            { type: 'SELECT',  label: '是否培训岗位',  fieldName: 'isTrain',      placeholder: '请选择',  initialValue: "", itemList:  this.createDictList('1004') },
            { type: 'INPUT',   label: '岗位代码',     fieldName: 'stationCode',  placeholder: '请输入',  initialValue: ""},
            { type: 'INPUT',   label: '岗位名称',     fieldName: 'stationName',  placeholder: '请输入',  initialValue: ""},
            { type: 'SELECT',  label: '启用标志',     fieldName: 'enable',       placeholder: '请选择',  initialValue: "", itemList:  this.createDictListRemoveCodes('1003', ['10031002']) }
        ]
      },
      //搜索获取数据
      changeHandle(val){
          this.flterValue = Object.assign({},val);
          this.flterValue.enable = 10031001;
      },
      //table表头和数据源
      creatHeader(){
         return [
         {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
         },
        {
         title: '岗位代码',
         dataIndex: 'stationCode',
         sorter: true
         },
        {
          title: '岗位名称',
          dataIndex: 'stationName',
          sorter: true
          },
        {
          title: '是否培训岗位',
          dataIndex: 'isTrain',
          sorter: true,
          filterItems: this.createDictList('1004'),
          render: props => {    //编码转汉字
            return <span>{this.createDictText(props.row.isTrain, '1004')}</span>;
          }},
         { title: '关键提醒', dataIndex: 'keyNotification', sorter: true,filterItems: this.createDictList('1004'),
           render: props => {    //编码转汉字
            return <span>{this.createDictText(props.row.keyNotification, '1004')}</span>;
          }},
        {
          title: '岗位描述',
          dataIndex: 'stationDesc',
          sorter: true
          },
        {
          title: '启用标志',
          dataIndex: 'enable',
          sorter: true,
          filterItems: this.createDictList('1003'),
          render: props => {    //编码转汉字
            return <span>{this.createDictText(props.row.enable, '1003')}</span>;
          }},
        ]
      },
    //详情
    dialogHandle(row,tpye){
      this.visible = true;
      const pram = {
        type: tpye
      };
    },
    //关闭详情
    dialogClose(){
      this.visible=false
      // if (type === 'refresh') {
      //   // 刷新列表数据
      //   this.fetchParams = { ...this.fetchParams };
      // }
    },
     collapseHandle() {
    }
  }
};
</script>

<style lang="less" scoped>
</style>
